<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class SalaryRule extends Model
{
    
    protected $table = 'salary_rule';
    protected $primaryKey = 'id';
    public $incrementing = true;
    protected $hidden = [];
    protected $guarded = [];

//    protected $fillable = ['edid','eid','CurrentHumidity','CurrentTemperature','LightLux','SoilMoisture','SoilTemperature','soilEC','Time','RequestId','greenhouseName','cropName','ctime', 'mtime','dtime','gid'];
    public $timestamps = false;

    public static function getList($where)
    {

        $data = DB::table('salary_rule as s')
            ->orderBy('s.id','asc');


//        if(!empty($where['name']))
//        {
//            $data->where('s.wifi_name','like','%'.$where['name'].'%');
//        }

        if(!empty($where['status']))
        {
            $data->where('s.status',$where['status']);
        }
        if(!empty($where['company_id']))
        {
            $data->where('s.company_id',$where['company_id']);
        }

        return $data->paginate(20);
    }


}